using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SkeletonMoveState : SkeletonGroundedState
{
    public SkeletonMoveState(Enemy enemyBase, Enemy_Skeleton enemy, StateMachine<EnemyState> stateMachine, string animBoolName) : base(enemyBase, enemy, stateMachine, animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        enemy.SetVelocity(enemy.moveSpeed*enemy.facingDir,enemy.YVelocity);
        if (enemy.IsWallDetected() || !enemy.IsGroundDetected())
        { 
            enemy.Flip();
            stateMachine.ChangeState(enemy.idleState);
        }
    }
}
